$(document).ready(function() {
	$('#home-link').addClass('nav-page');
	$('input:text').each(function() {
		$(this).attr('title', $(this).val());
		$(this).focus(function() {
			if ($(this).hasClass('textbox-label')) {
				$(this).removeClass('textbox-label');
				$(this).val('');
			}
		});
		$(this).blur(function() {
			if ($(this).val().length == 0) {
				$(this).addClass('textbox-label');
				$(this).val($(this).attr('title'));
			}
		});
	});
	$('#web-plus-link').click(function() {
		window.location = '/services/web-apps';
	});
	$('#cloud-plus-link').click(function() {
		window.location = '/services/cloud-apps';
	});
	$('#mobile-plus-link').click(function() {
		window.location = '/services/mobile-apps';
	});
	$('#contact-button').click(function() {
		var form = $('#contactus-form');
		var isValid = $app.validate(form);
		var postData = form.serialize();
		if (isValid) {
			$app.post({
			url : '/contactus',
			data : postData,
			success : function(r) {
				var thankspanel = $('<div/>');
				thankspanel.addClass('thank-you');
				form.replaceWith(thankspanel);
			},
			error : function(e) {
				alert('Please try numbers and alphabets only!');
			} });
		}
		else {
			alert('The input doesnt seem correct! Please use alphabets, numbers and/or (+,-,.,@) for your name and email address');
		}
	});
	$('#slideshow').cycle({
		fx : 'uncover' });
});
$(window).load(function() {
	$('#slideshow').cycle({
		fx : 'uncover' });
});